<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html> 
<base target="_self">
<head> 
<title>Code Select</title>
	<link rel="stylesheet" type="text/css" href="css/common.css">
	<link rel="stylesheet" type="text/css" href="css/table.css">
	<script type="text/javascript">
	function setFieldValue(){
		var obj = document.getElementById("codeselect");
		if(obj.selectedIndex!=-1)
			window.returnValue = obj.options[obj.selectedIndex].value;
		else
			window.returnValue = "";
		self.close();
		 
	}
	function cancelFieldValue(){
		window.returnValue = "";
		self.close();
	}
	</script>
</head> 
<body>
	
  <table width="100%" cellpadding="2" cellspacing="0" align="center"  id="resultTab">
    <tr>
      <td width=50% align="center" ><input class="mybutton" type="button" name="SelectIt" value=" 确定 "
        onclick='setFieldValue()'></td>
      <td width=50% align="center"><input name="CancelIt" class="mybutton" type="button" value=" 取消 "
        onclick='cancelFieldValue()'></td>
    </tr>
    <tr>
      <td colspan=2 align="center" width="100%">
      <select id=codeselect class="one" size=20 style="width:100%"  ondblclick="setFieldValue()">
        <c:forEach items="${dialogModels}" var="dialog">
        <option value="${dialog.code }-${dialog.value }">${dialog.code }&nbsp;&nbsp;--&nbsp;&nbsp;${dialog.value }</option>
        </c:forEach>
      </select>
     </td>
    </tr>
  </table>
  <script type="text/javascript">
  var code = window.dialogArguments;
  var obj = document.getElementById("codeselect");
  for(var i=0;i<obj.options.length;i++){
	  if(code == obj.options[i].value.split("-")[0]){
		  obj.options[i].selected =true;
		  break;
	  }
  }
  </script>
</body>
</html>